home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / midi / gfft.lha / gfft-2.03 / source / gfft-2.03-source.lha / delay.c < prev    next >
C/C++ Source or Header  |  1996-01-02  |  2KB  |  62 lines

  1. /***************************************************************************
  2.  *          Copyright (C) 1995  Charles P. Peterson                  *
  3.  *         4007 Enchanted Sun, San Antonio, Texas 78244-1254             *
  4.  *              Email: Charles_P_Peterson@fcircus.sat.tx.us                *
  5.  *                                                                         *
  6.  *          This is free software with NO WARRANTY.                  *
  7.  *          See gfft.c, or run program itself, for details.              *
  8.  *              Support is available for a fee.                      *
  9.  ***************************************************************************
  10.  *
  11.  * Program:     gfft--General FFT analysis
  12.  * File:        gopen.c
  13.  * Purpose:     Wait a specified number of seconds
  14.  * Author:      Charles Peterson (CPP)
  15.  * History:     26-Jan-1995 CPP (1.26) Created.
  16.  * Comments:    
  17.  */
  18.  
  19. #include <stdio.h>  /* FALSE, TRUE */
  20. #include <exec/types.h>
  21. #include <devices/timer.h>
  22. #include <clib/exec_protos.h>
  23. #include <clib/alib_protos.h>
  24.  
  25. void delay (int seconds)
  26. {
  27.     struct MsgPort *timer_mp;
  28.     struct timerequest *timer_iorp;
  29.     int error = 0;
  30. /*
  31.  * Open timer device
  32.  */
  33.  
  34.     if (timer_mp = CreatePort (0,0))
  35.     {
  36.     if (timer_iorp = (struct timerequest *)
  37.           CreateExtIO (timer_mp, sizeof (struct timerequest)))
  38.     {
  39.         if (!(error=OpenDevice(TIMERNAME, UNIT_MICROHZ, 
  40.                    (struct IORequest *) timer_iorp, 0)))
  41.         {
  42.  
  43. /*
  44.  * Submit timer request
  45.  */
  46.         timer_iorp->tr_node.io_Command = TR_ADDREQUEST;
  47.         timer_iorp->tr_time.tv_secs = seconds;
  48.         timer_iorp->tr_time.tv_micro = 0;
  49.         DoIO ((struct IORequest *) timer_iorp);
  50.  
  51. /*
  52.  * Cleanup
  53.  */
  54.         CloseDevice ((struct IORequest *) timer_iorp);
  55.         }
  56.         DeleteExtIO ((struct IORequest *) timer_iorp);
  57.     }
  58.     DeletePort(timer_mp);
  59.     }
  60. }
  61.  
  62.